package com.common.account.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.common.account.entity.UserAndMechanismDirectlyUnder;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户组织 Mapper 接口
 * </p>
 *
 * @author wangguochao
 * @since 2021-01-29
 */
public interface UserAndMechanismDirectlyUnderMapper extends BaseMapper<UserAndMechanismDirectlyUnder> {
    /**
     * 查询部门权限
     *
     * @param userName 用户名
     * @return 部门ID
     */
    @Select("select uamdu.au_mechanism_id " +
            "from au_user au " +
            "         join user_and_mechanism_directly_under uamdu on uamdu.au_user_id = au.id " +
            "where au.user_name = #{userName}")
    List<String> findByUserName(String userName);
}
